package com.bosssoft.trainee.gateway.feign;

import com.bosssoft.trainee.gateway.feign.hystrix.GateWayHystrix;
import com.bosssoft.trainee.mbg.result.CommonResult;
import com.bosssoft.trainee.mbg.vo.UserVO;
import com.bosssoft.trainee.security.bo.UserBO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Author: wuxin
 * @Project: rbac-SpringCloud
 * @Date: 2022/7/13
 * @Description:
 */
// 添加为容器内的一个组件
@Component
// 服务提供者提供的服务名称，即 application.name
@FeignClient(value = "trainee-rbac", fallback = GateWayHystrix.class)
public interface GatewayFeign {
    @GetMapping(value = "/api/loadUserByUsername")
    UserBO loadUserByUsername(@RequestParam("username") String username);

    @GetMapping(value = "/api/checkWorkerNum")
    CommonResult<Boolean> checkWorkerNum(@RequestParam("workerNum") String workerNum,@RequestParam("id")Integer id);

    @GetMapping(value = "/api/checkUsername")
    public CommonResult<Boolean> checkUsername(@RequestParam("username") String username,@RequestParam("id")Integer id);


    @GetMapping(value = "/api/checkRoleCode")
    public CommonResult<Boolean> checkRoleCode(@RequestParam("code") String code,@RequestParam("id")Integer id);


    @GetMapping(value = "/api/checkResoCode")
    public CommonResult<Boolean> checkResoCode(@RequestParam("code") String code,@RequestParam("id")Integer id);


    @GetMapping(value = "/api/checkApi")
    public CommonResult<Boolean> checkApi(@RequestParam("api") String api,@RequestParam("id")Integer id);

    @GetMapping(value = "/api/checkUrl")
    public CommonResult<Boolean> checkUrl(@RequestParam("url") String url,@RequestParam("id")Integer id);

    @GetMapping(value = "/api/info")
    public UserVO getUSerInfo(@RequestParam("token") String token);
}
